#define _CRT_SECURE_NO_WARNINGS

#include"My_List.h"

struct Pos
{
	int _row;
	int _col;

	Pos(int row = 0, int col = 0)
		:_row(row)
		, _col(col)
	{}
};

void print_list(const HB::list<Pos>& lt)
{
	HB::list<Pos>::const_iterator it = lt.begin();
	while (it != lt.end())
	{
		//it->_row++;

		std::cout << it->_row << ":" << it->_col << std::endl;

		++it;
	}
	std::cout << std::endl;
}


void test_list()
{
	HB::list<Pos> lt;
	Pos p1(1, 1);
	lt.push_back(p1);
	lt.push_back(p1);
	lt.push_back(p1);
	lt.push_back(Pos(2, 2));
	lt.push_back(Pos(3, 3));

	// int* p  -> *p
	// Pos* p  -> p->
	HB::list<Pos>::iterator it = lt.begin();
	//list<Pos>::iterator it2 = it;
	while (it != lt.end())
	{
		it->_row++;

		//cout << (&(*it))->_row << ":" << (*it)._col << endl;
		std::cout << it->_row << ":" << it->_col << std::endl;
		//cout << it.operator->()->_row << ":" << it->_col << endl;

		++it;
	}
	std::cout << std::endl;

	print_list(lt);
}

int main()
{
	HB::list<int> lt1(3, 8);
	for (auto a : lt1)
	{
		std::cout << a;
	}

	HB::list<int> lt2(lt1);
	for (auto a : lt2)
	{
		std::cout << a;
	}
	HB::list<int> lt3(3, 9);

	lt3.pop_back();
	lt3.pop_back();
	lt3.push_back(6);
	lt3.push_front(1);
	for (auto a : lt3)
	{
		std::cout << a;
	}
	std::cout << std::endl;
	test_list();
	return 0;
}